<template>
	<view class="content">
		
		<!-- 顶部文字 -->
		<text class="title">{{$t('login.phoneLogin')}}</text>
		<!-- 登录框 -->
		<view v-if="['apple','weixin'].includes(type)" class="quickLogin">
			<image @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image>
			<!-- <uni-agreements @setAgree="agree = $event"></uni-agreements> -->
		</view>

		<uni-quick-login ref="uniQuickLogin"></uni-quick-login>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type: "",
				phone: "",
			}
		},
		computed: {

			imgSrc() {
				return '/static/login-index/' + this.type + '.png'
			}
		},
		onLoad(e) {
			this.type = e.type

			//是否优先启动一键登录。即：页面一加载就启动一键登录


		},
		onUnload() {
			uni.$off('setLoginType')
		},
		onReady() {

		},
		methods: {
			quickLogin() {
				this.$refs.uniQuickLogin.login_before(this.type)
			},
			sendShortMsg() {
				// if (!this.agree) {
				// 	return uni.showToast({
				// 		title: this.$t('common').noAgree,
				// 		icon: 'none'
				// 	});
				// }
				// 发送验证吗
				// 	uni.showLoading();
				// 	uni.navigateTo({
				// 		url: '/pages/ucenter/login-page/phone-code/phone-code?phoneNumber=' + this.phone,
				// 		complete: () => {
				// 			uni.hideLoading();
				// 		}
				// 	});
				// },

			}
		}
	}
</script>

<style lang="scss" scoped>
	/* #ifndef APP-NVUE */
	view {
		display: flex;
		box-sizing: border-box;
		flex-direction: column;
	}

	/* #endif */

	@import url("../common/login-page.css");

	.quickLogin {
		width: 650rpx;
		height: 350px;
		align-items: center;
		justify-content: center;
	}

	.quickLoginBtn {
		margin: 20px 0;
		width: 450rpx;
	}
</style>
